﻿using DBBaseServer.Configurations;
using Prism.Mvvm;
using DBBaseServer.Services;
using DBBaseServer.AbstractModel;
using DBBaseServer.Entities;
using System.Linq;
using System.Windows.Input;
using Prism.Commands;
using YJTTool.Common.Events;
using System;
using System.Windows.Navigation;
using Prism.Navigation;
using YJTTool.MainWindow.Views;
using Prism.Regions;
using YJTTool.Common;
using YJTTool.MainWindow.ViewModels;
using YJTTools.Views;
using System.Windows;
using YJTTool.Common.Manager;

namespace YJTTools.ViewModels
{
    public class MainWindowViewModel : BindableBase,INavigationAware
    {
        #region 内部字段
        private readonly IRegionManager regionManager;
        private readonly AbstractUserInfoServer abstractUserInfo;
        #endregion

        #region 属性

        #endregion

        private string _title = "YJTTool Application";
        public string Title
        {
            get { return _title; }
            set { SetProperty(ref _title, value); }
        }

        public MainWindowViewModel(AbstractUserInfoServer abstractUserInfo, IRegionManager regionManager)
        {
            this.regionManager = regionManager;
            this.abstractUserInfo = abstractUserInfo;
            BoolEvent.Instance.Subscribe(LoginCommandMethod);
        }
        /// <summary>
        /// 登录方法
        /// </summary>
        private void LoginCommandMethod(bool message)
        {
            if (message)
            {

            }
            else
            {
               
                regionManager.RequestNavigate("OptionRegion", "NavigatePageView");
            }
        }

        public void OnNavigatedTo(NavigationContext navigationContext)
        {
            
        }

        public bool IsNavigationTarget(NavigationContext navigationContext)
        {
            return true;
        }

        public void OnNavigatedFrom(NavigationContext navigationContext)
        {
            
        }
    }
}
